package com.example.stuwork.pojo;

import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.util.Date;

/**
 * 课程公告实体类
 * 对应 course_announcement 表
 */
public class CourseAnnouncement implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 公告ID
     */
    private Long announcementId;
    
    /**
     * 课程编码
     */
    private String courseId;
    
    /**
     * 班级ID
     */
    private Long classId;
    
    /**
     * 发布教师工号
     */
    private String teacherId;
    
    /**
     * 公告标题
     */
    private String title;
    
    /**
     * 公告内容
     */
    private String content;
    
    /**
     * 发布时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;
    
    /**
     * 更新时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date updateTime;

    /**
     * 无参构造函数
     */
    public CourseAnnouncement() {
    }

    /**
     * 全参构造函数
     */
    public CourseAnnouncement(Long announcementId, String courseId, Long classId, String teacherId, 
                              String title, String content, Date createTime, Date updateTime) {
        this.announcementId = announcementId;
        this.courseId = courseId;
        this.classId = classId;
        this.teacherId = teacherId;
        this.title = title;
        this.content = content;
        this.createTime = createTime;
        this.updateTime = updateTime;
    }

    /**
     * 用于创建新公告的构造函数
     */
    public CourseAnnouncement(String courseId, Long classId, String teacherId, String title, String content) {
        this.courseId = courseId;
        this.classId = classId;
        this.teacherId = teacherId;
        this.title = title;
        this.content = content;
    }

    // Getter and Setter
    public Long getAnnouncementId() {
        return announcementId;
    }

    public void setAnnouncementId(Long announcementId) {
        this.announcementId = announcementId;
    }

    public String getCourseId() {
        return courseId;
    }

    public void setCourseId(String courseId) {
        this.courseId = courseId;
    }

    public Long getClassId() {
        return classId;
    }

    public void setClassId(Long classId) {
        this.classId = classId;
    }

    public String getTeacherId() {
        return teacherId;
    }

    public void setTeacherId(String teacherId) {
        this.teacherId = teacherId;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    @Override
    public String toString() {
        return "CourseAnnouncement{" +
                "announcementId=" + announcementId +
                ", courseId='" + courseId + '\'' +
                ", classId=" + classId +
                ", teacherId='" + teacherId + '\'' +
                ", title='" + title + '\'' +
                ", content='" + content + '\'' +
                ", createTime=" + createTime +
                ", updateTime=" + updateTime +
                '}';
    }
} 